/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BeansGerenciaveis;

import DAO.NoticiaDAO;
import bean.Noticia;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author jorgefspf
 */
@ManagedBean
@ViewScoped
public class NoticiaBeanConsulta {

    /**
     * Creates a new instance of NoticiaBeanConsulta
     */
    
    private NoticiaDAO nDAO = new NoticiaDAO();
    private Noticia noticiaSelecionada = new Noticia();
    
    public NoticiaBeanConsulta() {
    }
    
    public List<Noticia>buscarDestaques(){
        
        ArrayList<Noticia> destaques = new ArrayList();
        
        destaques = (ArrayList<Noticia>) nDAO.buscarDestaques();
        
        
        return destaques;
    }

    public Noticia getNoticiaSelecionada() {
        return nDAO.buscarNoticia(noticiaSelecionada.getId());
    }

    public void setNoticiaSelecionada(Noticia noticiaSelecionada) {
        this.noticiaSelecionada = noticiaSelecionada;
    }
    
    
    
}
